import { Component, OnInit , Input} from '@angular/core';
import { AppGlobalService } from '../../shared/service/app-global.service';

@Component({
  selector: 'app-optimization-brand',
  templateUrl: './optimization-brand.component.html',
  styleUrls: ['./optimization-brand.component.scss'],
})
export class OptimizationBrandComponent implements OnInit {
  @Input() tagData: any;
  constructor(private appGlobalService: AppGlobalService) { }

  ngOnInit() {
    /* js操作dom，暂时先不管 */
   /*  if (document.getElementById('imgone')){
      const width = document.getElementById('imgone').offsetWidth;
      console.log(width)
      document.getElementById('brandnamebg').style.width = width + 'px';
    } */
    /* if (document.getElementById('imgtwo')){
      const width = document.getElementById('imgtwo').offsetWidth;
      console.log(width)
      document.getElementById('brandnamebg2').style.width = width + 'px';
    }
    if (document.getElementById('imgthree')){
      const width = document.getElementById('imgthree').offsetWidth;
      console.log(width)
      document.getElementById('brandnamebg3').style.width = width + 'px';
    } */
    /* this.tagData={
      "type":"tag",
      "style":"premiumTopTag",
      "name":null,
      "linearLayout":"body",
      "data":{
          "link":{
              "type":"page",
              "params":{
                  "name":"value"
              },
              "target":"122956"
          },
          "title":"优选品牌",
          "list":[
              {
                  "intro":"自定义标题",
                  "name":"哈哈哈哈",
                  "pic":"https://zeno-img.oss-cn-shenzhen.aliyuncs.com/file_8f4c788fceec915b28db630ed434d375.jpg"
              },
              {
                  "intro":"这是广告信息的自定义标题",
                  "name":"哈哈哈哈",
                  "pic":""
              },
              {
                  "intro":"",
                  "name":"",
                  "pic":""
              }
          ]
      }
  } */
  }
  // 跳转到品牌列表
  go(obj) {
    console.log(obj);
    const pageParams = {
      pageId: obj.target,
      params: obj.params,
      sessionId: localStorage.getItem('sessionId')
  };
    console.log(pageParams);
    this.appGlobalService.goToForward(pageParams);
  }
}